package com.kotasoft.iip.guice;

import javax.inject.Named;

import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.camel.component.jms.JmsComponent;
import org.apache.camel.guice.CamelModuleWithMatchingRoutes;
import org.apache.camel.guice.jndi.JndiBind;

import com.google.inject.Injector;
import com.google.inject.Provides;
import com.kotasoft.iip.integration.OrderRouteBuilder;
import com.kotasoft.iip.processor.MathProvisionLoader;

public class IntegrationModule extends CamelModuleWithMatchingRoutes {

	@Override
	protected void configure() {
		super.configure();
		bind(OrderRouteBuilder.class);
		// install(new InsuranceModule());
	}

	@Provides
	@JndiBind("jms")
	JmsComponent jms(@Named("activemq.brokerURL") String brokerURL) {
		return JmsComponent.jmsComponent(new ActiveMQConnectionFactory(brokerURL));
	}

	@Provides
	@JndiBind("mathProvisionLoader")
	public Object someBean(Injector injector) {
		return injector.getInstance(MathProvisionLoader.class);
	}
}
